#!/bin/sh
## 该脚本用于检测sersync2是否存在进程，无则启动，有则退出

sersync="/usr/local/sersync2/sersync2"
confxml="/usr/local/sersync2/confxml.xml"
ps aux |grep 'sersync2/confxml.xml'|grep -v 'grep'
if [ $? -ne '0' ];then
    echo "`date`====>sersync2进程不存在，现在启动进程..." >> /var/log/chk_sersync.log 
    $sersync -d -n 20 -o $confxml
        if [ $? -eq 0 ]
        then
            echo "sersync2启动成功"  >> /var/log/chk_sersync.log 
        else
            echo "sersync2启动失败！"  >> /var/log/chk_sersync.log 
    fi
else
    echo "`date`====>sersync2进程存在，退出检查程序。" >> /var/log/chk_sersync.log 
    exit 0
fi